package tests;

import common.Utils;
import org.bouncycastle.eac.EACCertificateBuilder;
import org.openqa.selenium.By;

/**
 * Created with IntelliJ IDEA.
 * Description:网页聊天室聊天页面测试
 * Author: WJW
 * Date: 2024-10-24
 * Time: 20:25
 */
public class ChatPage extends Utils {
    public static String url ="http://127.0.0.1:8080/client.html";
    public ChatPage() {
        super(url);
    }

    //检查页面是否加载成功
    public void ChatPageRight(){
        //点击搜索框
        driver.findElement(By.cssSelector("body > div.client-container > div > div.left > div.search"));
        //点击好友
        driver.findElement(By.cssSelector("body > div.client-container > div > div.left > div.tab > div.tab-friend")).click();
        //点击信息
        driver.findElement(By.cssSelector("body > div.client-container > div > div.left > div.tab > div.tab-session")).click();
        //点击信息列表第一条信息
        driver.findElement(By.cssSelector("#session-list > li:nth-child(1)"));
    }

    //发送消息成功
    public void SendSuc(){
        driver.findElement(By.cssSelector("#session-list > li:nth-child(1)")).click();
        driver.findElement(By.cssSelector("body > div.client-container > div > div.right > textarea")).sendKeys("加油！");
        driver.findElement(By.cssSelector("body > div.client-container > div > div.right > div.ctrl > button")).click();
        //检验是否发送成功
/*        String text = driver.findElement(By.cssSelector("body > div.client-container > div > div.right > div.message-show > div:nth-child(9) > div > p")).getText();
//        断言
       assert text.equals("越努力越幸运！");*/
    }


}
